import * as THREE from 'three'
/**
 * 纹理贴图
 */
const cubeTextureLoader = new THREE.CubeTextureLoader()
export const envMap = cubeTextureLoader.setPath(import.meta.env.BASE_URL+'texture/envmap/',).load([
    "px.jpg",
    "nx.jpg",
    "py.jpg",
    "ny.jpg",
    "pz.jpg",
    "nz.jpg",
])
envMap.mapping = THREE.CubeRefractionMapping
const textureLoader = new THREE.TextureLoader()
export let skyTextureEquirec = textureLoader.load(import.meta.env.BASE_URL+'texture/envmap/room.jpg');
skyTextureEquirec.mapping = THREE.EquirectangularReflectionMapping;
skyTextureEquirec.colorSpace = THREE.SRGBColorSpace;

export function disposeTexture() {
    envMap.dispose()
    skyTextureEquirec.dispose()
}

export function createFlowingLineTexture1(){
    // 管道纹理
    let flowingLineTexture1 = null
    flowingLineTexture1 = new THREE.TextureLoader().load(import.meta.env.BASE_URL + "public/assets/images/arrow-right.png")
    flowingLineTexture1.wrapS = flowingLineTexture1.wrapT = THREE.RepeatWrapping
    flowingLineTexture1.repeat.set(100, 1)
    flowingLineTexture1.needsUpdate = true
    return flowingLineTexture1
}
